# Generated by Django 4.2.4 on 2023-08-14 17:27

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Car',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50, verbose_name='модель')),
                ('year', models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='год выпуска')),
            ],
            options={
                'verbose_name': 'машина',
                'verbose_name_plural': 'машины',
            },
        ),
        migrations.CreateModel(
            name='Owner',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150, verbose_name='имя')),
                ('email', models.EmailField(max_length=254, unique=True, verbose_name='почта')),
            ],
            options={
                'verbose_name': 'владелец',
                'verbose_name_plural': 'владельцы',
            },
        ),
        migrations.CreateModel(
            name='CarHistory',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('start_year', models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='владел с')),
                ('stop_year', models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='владел по')),
                ('car', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='car.car', verbose_name='машина')),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='car.owner', verbose_name='владелец')),
            ],
            options={
                'verbose_name': 'история',
                'verbose_name_plural': 'истории',
            },
        ),
        migrations.AddField(
            model_name='car',
            name='owner',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='car.owner', verbose_name='владелец'),
        ),
    ]
